<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>RDOC_MAIN.rdoc</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            RDOC_MAIN.rdoc
        </h1>
        <ul class="files">
            
            <li>
                railties/RDOC_MAIN.rdoc
                
                    <a href="https://github.com/rails/rails/blob/323553703072b31a0c0139dc5fc4207279093cd5/railties/RDOC_MAIN.rdoc" target="_blank" class="github_url">on GitHub</a>
                
            </li>
            <li>Last modified: 2013-06-25 14:39:21 +0000</li>
        </ul>
    </div>

    <div id="bodyContent">
        <div id="content">
  
    <div class="description">
      
<h2 id="label-Welcome+to+Rails">Welcome to Rails</h2>

<p>Rails is a web-application framework that includes everything needed to
create database-backed web applications according to the <a
href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">Model-View-Controller
(MVC)</a> pattern.</p>

<p>Understanding the MVC pattern is key to understanding Rails. MVC divides
your application into three layers, each with a specific responsibility.</p>

<p>The View layer is composed of “templates” that are responsible for
providing appropriate representations of your application’s resources.
Templates can come in a variety of formats, but most view templates are
HTML with embedded Ruby code (.erb files).</p>

<p>The Model layer represents your domain model (such as Account, Product,
Person, Post) and encapsulates the business logic that is specific to your
application. In Rails, database-backed model classes are derived from <a
href="../../classes/ActiveRecord/Base.html">ActiveRecord::Base</a>. Active
Record allows you to present the data from database rows as objects and
embellish these data objects with business logic methods. Although most
Rails models are backed by a database, models can also be ordinary Ruby
classes, or Ruby classes that implement a set of interfaces as provided by
the <a href="../../classes/ActiveModel.html">ActiveModel</a> module. You
can read more about Active Record in its <a
href="http://api.rubyonrails.org/activerecord/README.rdoc">README</a>.</p>

<p>The Controller layer is responsible for handling incoming HTTP requests and
providing a suitable response. Usually this means returning HTML, but Rails
controllers can also generate XML, JSON, PDFs, mobile-specific views, and
more. Controllers manipulate models and render view templates in order to
generate the appropriate HTTP response.</p>

<p>In Rails, the Controller and View layers are handled together by Action
Pack. These two layers are bundled in a single package due to their heavy
interdependence. This is unlike the relationship between Active Record and
Action Pack, which are independent. Each of these packages can be used
independently outside of Rails. You can read more about Action Pack in its
<a href="http://api.rubyonrails.org/actionpack/README.rdoc">README</a>.</p>

<h2 id="label-Getting+Started">Getting Started</h2>
<ol><li>
<p>Install Rails at the command prompt if you haven’t yet:</p>

<pre>gem install rails</pre>
</li><li>
<p>At the command prompt, create a new Rails application:</p>

<pre>rails new myapp</pre>

<p>where “myapp” is the application name.</p>
</li><li>
<p>Change directory to <code>myapp</code> and start the web server:</p>

<pre>cd myapp; rails server</pre>

<p>Run with <code>--help</code> or <code>-h</code> for options.</p>
</li><li>
<p>Go to <a href="http://localhost:3000">localhost:3000</a> and you’ll see:</p>

<pre>&quot;Welcome aboard: You're riding Ruby on Rails!&quot;</pre>
</li><li>
<p>Follow the guidelines to start developing your application. You may find
the following resources handy:</p>
</li></ol>
<ul><li>
<p>The <a href="../activesupport/README_rdoc.html">README</a> file created
within your application.</p>
</li><li>
<p><a href="http://guides.rubyonrails.org/getting_started.html">Getting
Started with Rails</a>.</p>
</li><li>
<p><a href="http://ruby.railstutorial.org/ruby-on-rails-tutorial-book">Ruby on
Rails Tutorial</a>.</p>
</li><li>
<p><a href="http://guides.rubyonrails.org">Ruby on Rails Guides</a>.</p>
</li><li>
<p><a href="../../index.html">The API Documentation</a>.</p>
</li></ul>

<h2 id="label-Contributing">Contributing</h2>

<p>We encourage you to contribute to Ruby on Rails! Please check out the <a
href="http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html">Contributing
to Rails guide</a> for guidelines about how to proceed. <a
href="http://contributors.rubyonrails.org">Join us</a>!</p>

<h2 id="label-License">License</h2>

<p>Ruby on Rails is released under the <a
href="http://www.opensource.org/licenses/MIT">MIT License</a>.</p>

    </div>
  


  


  
  


  


  

  



  

    

    

    


    


    <!-- Methods -->
              </div>

    </div>
  </body>
</html>